  // 同时发送异步请求次数
  let subshow= 0;
const BASE_URL = "https://api-hmugo-web.itheima.net/api/public/v1";
export const request = (parsem)=>{
  // console.log(parsem)
  subshow++;
    wx.showLoading({
        title: '加载中',
        mask:true
      })
 return new Promise((resolve,rejects)=>{
    wx.request({
        url:BASE_URL+parsem.url,
        data:parsem.data,
        success:(result)=>{
           resolve(result)
        },
        fail:(err)=>{
            rejects(err)
        },
        complete:()=> {
            subshow--;
            if(subshow === 0){
            wx.hideLoading()
        }
        }
    })
 })
}